<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
    <head>
        <link href="/Public/Admin/css/manager/H-ui.min.css" rel="stylesheet" type="text/css"/>
        <link href="/Public/Admin/css/manager/H-ui.admin.css" rel="stylesheet" type="text/css"/>
        <link href="/Public/Admin/css/skin/default/skin.css" rel="stylesheet" type="text/css"/>
        <link href="/Public/Admin/css/manager/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css"/>
        <link href="/Public/Admin/css/common.css" rel="stylesheet" type="text/css"/>
        <link href="/Public/Admin/css/application.css" rel="stylesheet" type="text/css"/>
        <script type="text/javascript" src="/Public/static/jquery-1.11.1.min.js"></script>
        <script type="text/javascript" src="/Public/static/layer/layer.js"></script>
        <script type="text/javascript" src="/Public/Admin/js/H-ui.js"></script>
        <script type="text/javascript" src="/Public/Admin/js/H-ui.admin.js"></script>
        <script type="text/javascript" src="/Public/Admin/js/common.js"></script>
        <script type="text/javascript" src="/Public/Admin/js/jquery.raty.min.js"></script>
    </head>
    <body>
        <div class="clearfix" style="margin-top: 15px">
            <form id="myForm">
                <span class="select-box" style="width: 20%;margin: 10px 10px">
                  <select name="type" class="select" size="1">
                    <option value="1" selected>医生</option>
                    <option value="2">诊所</option>
                    <option value="3">患者</option>
                  </select>
                </span>
                <input type="text" placeholder="请输入搜索关键字" class="input-text ac_input" name="name" value="" id="search_text" autocomplete="off" style="width:300px"><button type="button" class="btn btn-success radius" id="search_button">搜索</button>
            </form>
        </div>
        <div class="panel panel-default mt-20" style="display: none" id="mydiv">
            <div class="panel-header">搜索结果</div>
            <div class="panel-body">
                <table class="table table-border table-bg">
                    <tr>
                        <th width="20%">id</th>
                        <th>名称</th>
                    </tr>
                    <tbody id="mybody">

                    </tbody>
                </table>
            </div>
        </div>
    </body>
    <script type="text/javascript">
        $('#search_button').click(function () {
            var name = $('#search_text').val();
            if(!name){
                layer.tips('请输入搜索关键字', '#search_text',{
                    tips: [1, '#78BA32']
                });
                return false;
            }
            //搜索结果
            $('#mydiv').hide();
            $('#mybody').empty();
            layer.load();
            var data = $('#myForm').serialize();
            $.post(location.href,data,function (data) {
                layer.closeAll('loading');
                if(data.code==0){
                    var mydata = data.data;
                    var html = '';
                    if(mydata){
                        $.each(mydata,function (i,n) {
                            html += '<tr>\
                            <th>'+n.id+'</th>\
                            <th>'+n.name+'</th>\
                            </tr>';
                        });
                    }else{
                        html = '<tr><th></th><th>无对应结果</th></tr>';
                    }
                    $('#mybody').append(html);
                    $('#mydiv').show();
                }else{
                    layer.msg('搜索出现问题了, 请稍后再试')
                }
            },'json')
        });
    </script>
</html>